package tools;

import org.json.JSONObject;

public class Hot {
	private String mid;//标识符
	private String word;//热搜标题
	private long onboard_time;//上榜时间，10位时间戳
	private String category;//热搜类型
	private long num;//阅读量
	private int rank;//排名
	private String label_name;//标签，如“热”，“新”，“沸”或者空
	private String url;//链接
	private String text;//介绍
	private String pic;//封面地址
	
	public String getText() {
		return text;
	}
	public void setText(String text) {
		this.text = text;
	}
	public String getPic() {
		return pic;
	}
	public void setPic(String pic) {
		this.pic = pic;
	}
	public String getMid() {
		return mid;
	}
	public void setMid(String mid) {
		this.mid = mid;
	}
	public String getWord() {
		return word;
	}
	public void setWord(String word) {
		this.word = word;
	}
	public long getOnboard_time() {
		return onboard_time;
	}
	public void setOnboard_time(long onboard_time) {
		this.onboard_time = onboard_time;
	}
	public String getCategory() {
		return category;
	}
	public void setCategory(String category) {
		this.category = category;
	}
	public long getNum() {
		return num;
	}
	public void setNum(long num) {
		this.num = num;
	}
	public int getRank() {
		return rank;
	}
	public void setRank(int rank) {
		this.rank = rank;
	}
	public String getLabel_name() {
		return label_name;
	}
	public void setLabel_name(String label_name) {
		this.label_name = label_name;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}

	public Hot(String mid, String word, long onboard_time, String category, long num, int rank, String label_name,String url) {
		super();
		this.mid = mid;
		this.word = word;
		this.onboard_time = onboard_time;
		this.category = category;
		this.num = num;
		this.rank = rank;
		this.label_name = label_name;
		this.url = url;
	}
	
	public Hot(JSONObject jsonObject) {
		super();
		this.mid = jsonObject.getString("mid");
		this.word = jsonObject.getString("word");
		this.onboard_time = jsonObject.getLong("onboard_time");
		this.category = jsonObject.getString("category");
		this.num = jsonObject.getLong("num");
		this.rank = jsonObject.getInt("rank");
		this.label_name = jsonObject.getString("label_name");
		this.url = jsonObject.getString("url");
		this.text = jsonObject.getString("text");
		this.pic = jsonObject.getString("pic");
	}

	@Override
	public String toString() {
		return String.format("mid:%s,word:%s,category:%s,label_name:%s,onboard_time:%d,num:%d,rank:%d,pic:%s,text:%s", mid, word, category, label_name, onboard_time, num, rank, pic, text);
	}
	
	public JSONObject getJsonObject() {
		JSONObject jsObj = new JSONObject();
		jsObj.put("mid", mid);
		jsObj.put("word", word);
		jsObj.put("onboard_time", onboard_time);
		jsObj.put("category", category);
		jsObj.put("num", num);
		jsObj.put("rank", rank);
		jsObj.put("label_name", label_name);
		jsObj.put("url", url);
		jsObj.put("text", text);
		jsObj.put("pic", pic);
		return jsObj;
	}

}
